package com.fangjinwang.zhushunqing.Ui.Home.Model;

import com.fangjinwang.zhushunqing.Api.Api;
import com.fangjinwang.zhushunqing.Ui.Home.contrct.HomeContrct;
import com.jaydenxiao.common.baserx.RxSchedulers;

import rx.Observable;
import rx.functions.Func1;

/**
 * Created by admin on 2016/11/4.
 */
public  class HomeModel extends HomeContrct.Model{

//    @Override
//    public Observable<HomeEntity> getHomeData(String method,String requestData,boolean isEncrypt,String token) {
//        return Api.getService().getHome(initApiData(method,requestData,isEncrypt,token)).map(new Func1<BaseRespose<HomeEntity>, HomeEntity>() {
//                  @Override
//                  public HomeEntity call(BaseRespose<HomeEntity> homeEntityBaseRespose) {
//                Log.d("---tag----",homeEntityBaseRespose.getD().toString());
//                return homeEntityBaseRespose.getD();
//            }
//        }).compose(RxSchedulers.<HomeEntity>io_main());
//    }
    @Override
public Observable<String> getHomeData(String method, String requestData, boolean isEncrypt, String token){
        return Api
                .getService()
                .getHome(initApiData(method,requestData,isEncrypt,token))
                .map(new Func1<String, String>() {
            @Override
            public String call(String s) {
//                BaseRespose<HomeEntity> apiBean = JSON.parseObject(s, BaseRespose.class);
                return s;
            }//compose(RxSchedulers.<String>io_main())
        }).compose(RxSchedulers.<String>io_main());

}
}
